import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect: '/sys-admin/index',
    children: [
      {
        path: '/sys-admin/index',
        component: () => import('../views/sys-admin/SystemAdminIndex.vue')
      },
      {
        path: '/sys-admin/temp/admin/add-new',
        component: () => import('../views/sys-admin/temp/AdminAddNewView.vue')
      },
      {
        path: '/sys-admin/temp/admin/list',
        component: () => import('../views/sys-admin/temp/AdminListView.vue')
      },
      {
        path: '/sys-admin/temp/user/add-new',
        component: () => import('../views/sys-admin/temp/UserAddNewView.vue')
      },
      {
        path: '/sys-admin/temp/user/list',
        component: () => import('../views/sys-admin/temp/UserListView.vue')
      },
      {
        path: '/sys-admin/temp/complaint/list',
        component: () => import('../views/sys-admin/temp/ComplaintListView.vue')
      },
      {
        path: '/sys-admin/temp/complaint/add-new',
        component: () => import('../views/sys-admin/temp/ComplaintAddNewView.vue')
      },
      {
        path: '/sys-admin/temp/maintain/list',
        component: () => import('../views/sys-admin/temp/MaintainListView.vue')
      },
      {
        path: '/sys-admin/temp/maintain/add-new',
        component: () => import('../views/sys-admin/temp/MaintainAddNewView.vue')
      },
      {
        path: '/sys-admin/temp/advise/list',
        component: () => import('../views/sys-admin/temp/AdviseListView.vue')
      },
      {
        path: '/sys-admin/temp/advise/add-new',
        component: () => import('../views/sys-admin/temp/AdviseAddNewView.vue')
      },
    ]
  },
  {
    path: '/about',
    component: () => import('../views/AboutView.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/AdminLoginView.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
